package com.bai.sm.pojo;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.Date;

/**
 * Created by Admin on 2/16 0016.
 */
@RunWith(SpringJUnit4ClassRunner.class) //使用Springtest框架
@ContextConfiguration("/beans.xml") //加载配置
public class UserTest {
    @Autowired //注入
    private UserMapper userMapper;

    @Test
    public void test() {
        User user = new User();
        user.setBirthday(new Date());
        user.setName("JieXi");
        user.setSalary(500);
        userMapper.save(user);
        System.out.println(user.getId());

// Map<String,Object> m=new HashMap<>();
//        m.put("name","Marry");
//        m.put("salary",2000);
//        m.put("birthday",new Date());
//        userMapper.save(m);
    }
}
